home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / osr5 / sco / scripts / admin / checkhomes < prev    next >
Encoding:
Korn shell script  |  1997-08-26  |  846 b   |  25 lines

  1. #!/bin/ksh
  2. # @(#) checkhomes.ksh 1.0 96/06/17
  3. # 93/09/13 John H. DuBois III (john@armory.com)
  4. # 94/06/27 Added help.
  5. # 96/06/17 su to daemon instead of nouser; nouser has no shell under 3.2v5
  6.  
  7. if [ $# -gt 0 ]; then
  8.     print \
  9. "${0##*/}: Check home directories to make sure they aren't writable.
  10. Writable home directories are subject to various types of attack; for example
  11. a .rhosts attack.  A line is printed for each user with a publicly writeable
  12. home directory giving the user name and home directory."
  13.     exit 0
  14. fi
  15. # need to su to a user with a shell who is unlikely to be in any group that
  16. # a user would change their home dir group ownership to.
  17. # daemon is as good a bet as any other.
  18. su daemon -c ksh <<\END
  19. IFS=:
  20. typeset -L8 user
  21. while read user p uid gid n home s; do
  22.     [ -w "$home" ] && echo "$user  $home"
  23. done < /etc/passwd
  24. END
  25.